/**
 * 
 */
package com.cmpanyandi.elearning.utils.db;

import java.util.ArrayList;
import java.util.List;

/**
 * This beans defines DATA base
 * 
 * @author wojtek
 * 
 */
public class DBDescriptor {

    /** DB name */
    private String databaseName;

    /** DB version */
    private int version;

    private List<String> createStatements = new ArrayList<String>();

    private List<UpdateStatemet> updateStatements = new ArrayList<UpdateStatemet>();

    
    public DBDescriptor(String databaseName, int version) {
	this.databaseName = databaseName;
	this.version = version;
    }

   
    /**
     * Add create data base statement.
     * 
     * @param string
     *            - statement.
     */
    public void addCreateStatement(String string) {
	createStatements.add(string);
    }

    public void addUpdateStatement(int version, String stmt) {
	updateStatements.add(new UpdateStatemet(version, stmt));
    }

    /**
     * 
     * This class describe update statement
     * 
     * @author wojtek
     * 
     */
    public static class UpdateStatemet {

	private int version;
	private String statement;

	private UpdateStatemet(int version, String sql) {
	    this.version = version;
	    this.statement = sql;
	}

	/**
	 * @return the version
	 */
	public int getVersion() {
	    return version;
	}

	/**
	 * @return the statement
	 */
	public String getStatement() {
	    return statement;
	}

    }

    /**
     * @return the databaseName
     */
    public String getDatabaseName() {
	return databaseName;
    }

    /**
     * @return the version
     */
    public int getVersion() {
	return version;
    }

    /**
     * @return the createStatements
     */
    public List<String> getCreateStatements() {
	return createStatements;
    }

    /**
     * @return the updateStatements
     */
    public List<UpdateStatemet> getUpdateStatements() {
	return updateStatements;
    }

}
